<?php 

include("resize.php");


if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {

	$im = $GLOBALS["HTTP_RAW_POST_DATA"];
	
	$filename = "aver.jpg";
	
	$fullFilePath = "./fotos/zoom/".$filename;

	$handle=fopen($fullFilePath,"w");

	fwrite($handle,$im);
	fclose($handle); 
	
	
	//redimensión
		$thumb=new thumbnail($fullFilePath);
		$thumb->size_height(700);
		$thumb->jpeg_quality(100);
		$thumb->save($fullFilePath);
	//fin 
	
	$fullFilePath = "./fotos/galeria/".$filename;

	$handle=fopen($fullFilePath,"w");

	fwrite($handle,$im);
	fclose($handle); 
	
	//redimensión
		$thumb=new thumbnail($fullFilePath);
		$thumb->size_height(450);
		$thumb->jpeg_quality(85);
		$thumb->save($fullFilePath);
	//fin 
	
	$fullFilePath ="./fotos/home/". $filename;

	$handle=fopen($fullFilePath,"w");

	fwrite($handle,$im);
	fclose($handle); 
	
	//redimensión
		$thumb=new thumbnail($fullFilePath);
		$thumb->size_height(100);
		$thumb->jpeg_quality(85);
		$thumb->save($fullFilePath);
	//fin 
		
}

$x = ImageSX($img);//ancho
$y = ImageSY($img);//alto

$contenido = $x.'-'.$y;

chmod("./fotos/zoom/".$filename, 0777);
chmod("./fotos/galeria/".$filename, 0777);
chmod("./fotos/home/".$filename, 0777);


 ?>
